from sys import argv

script,input_file = argv

def print_all(f):
    print(f.read())   #读文件中所有内容

def rewind(f):
    f.seek(0)    #将读写位置移动到开头

def print_line(line_count,f):
    print(line_count,f.readline())  #输入行号和文件，输出行号和对应行内容

current_file = open(input_file)

print("Print the whole file:\n")

print_all(current_file)

print("Let`s rewind")

#rewind(current_file)

print("Let`s print three lines")

current_line = 1
print_line(current_line,current_file)

current_line=2
print_line(current_line,current_file)

current_line=current_line + 1
print_line(current_line,current_file)